package com.SmartCare.controller.manager;


import com.SmartCare.common.Result;
import com.SmartCare.pojo.message.IdentityVerification;
import com.SmartCare.service.message.IdentityVerificationService;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 身份验证 前端控制器
 */
@RestController
@RequestMapping("/identity-verification")
@Api(tags = "后台管理端身份审核消息接口")
public class IdentityVerificationController {
    @Resource
    IdentityVerificationService identityVerificationService;

    @GetMapping("/listByName")
    @Operation(summary = "获取请求消息", description = "根据养老院名称获取发向指定养老院的请求消息")
    public Result getListByCareHomeName(@Parameter(description = "养老院的名称", required = true) @RequestParam String name) {
        return identityVerificationService.getListByCareHomeName(name);
    }

    @PutMapping("/update")
    @Operation(summary = "更新请求信息", description = "更新请求信息的状态")
    public Result update(@Parameter(description = "消息对象", required = true) @RequestBody IdentityVerification msg) {
        return identityVerificationService.updateMsg(msg);
    }

    @GetMapping("/get-messages")
    public Result getMessages(@RequestParam Long userId){
        return identityVerificationService.getAllMessagesByUserId(userId);
    }
}

